package com.yjc.sunnyweather.util

import android.content.Context
import android.os.Handler
import android.os.Looper
import android.os.Message
import kotlin.math.ceil

object CommonUtil {

    fun getStatusBarHeight(context: Context): Float {
        return ceil(25 * context.resources.displayMetrics.density)
    }

    fun getHandler(func: () -> Unit) : Handler {
        return object : Handler(Looper.getMainLooper()) {
            override fun handleMessage(msg: Message) {
                super.handleMessage(msg)
                func()
            }
        }
    }

}